package com.joysuch.wwyt.bp.entity.investigate;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * @Author ZhangDong
 * @Date 2020/12/8 10:14
 */
@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_bp_investigate_task")
@TableName("wwyt_bp_investigate_task")
@SQLDelete(sql = "update wwyt_bp_investigate_task set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_bp_investigate_task set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Data
@Accessors(chain = true)
public class BpInvestigateTask {

    @Id
    @TableId(value = "id", type = IdType.INPUT)
//    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("主键id")
    private Long id;
    @ApiModelProperty("排查计划id")
    private Long planId;
    @ApiModelProperty("排查人员id")
    private Long userId;
    @ApiModelProperty("排查日期")
    private Date checkDate;
    @ApiModelProperty("状态: 待完成; 未完成; 已完成; 被完成; 逾期完成")
    private String status;
    @ApiModelProperty("记录id")
    private Long recordId;
    @ApiModelProperty("记录id")
    private Integer sourceType;
    @ApiModelProperty("截至日期")
    private Date deadline;
    @ApiModelProperty("周期单位")
    private String periodUnit;
    @ApiModelProperty("周期")
    private Integer periodDays;
    @ApiModelProperty("排查频次")
    private String checkRateDescribe;
    @ApiModelProperty("风险区域")
    private Long districtId;
    @ApiModelProperty("风险区域")
    private Long departId;

    @ApiModelProperty("排查日期")
    private Date checkEndDate;


    //通用字段
    @ApiModelProperty("创建人")
    @org.springframework.data.annotation.CreatedBy
    @JsonIgnore
    private Long createBy;
    @ApiModelProperty("创建时间")
    @org.springframework.data.annotation.CreatedDate
    @JsonIgnore
    private java.time.LocalDateTime createTime;
    @ApiModelProperty("更新人")
    @org.springframework.data.annotation.LastModifiedBy
    @JsonIgnore
    private Long updateBy;
    @ApiModelProperty("更新时间")
    @org.springframework.data.annotation.LastModifiedDate
    @JsonIgnore
    private java.time.LocalDateTime updateTime;
    @ApiModelProperty("租户")
    private Long tenentId;
    @ApiModelProperty("组织机构代码")
    private String orgCode;
    @ApiModelProperty("删除标记")
    @JsonIgnore
    private String deleteFlag;

    @ApiModelProperty(value = "任务完成时间")
    private Date finishDate;
}
